package day14;

import java.beans.XMLDecoder;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.util.List;

/**
 * @author oldliu
 * @since 1.0
 */
public class XMLDecoderDEmto {
    public static void main(String[] args) {
        try {
            XMLDecoder xd=new XMLDecoder(new FileInputStream("products.xml"));
            List<Product> p = (List<Product>) xd.readObject();
            xd.close();
            for(Product product:p)
                System.out.println(product);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
